home *** CD-ROM | disk | FTP | other *** search
- 10 'Box design program to calculate ideal box dimensions from a given volume.
- 20 'or volume from the largest dimension, based on the ideal shape of the box.
- 30 'The dimensional relationship provides the fewest redundant eigenmodes
- 40 'in the decay spectrum of an enclosure's internal sound wave reflections.
- 50 'Written by Drew Daniels, Applications Engineer, JBL Incorporated, 2/20/85
- 60 '
- 70 '
- 80 'variable definitions
- 85 '
- 90 '
- 100 LOG10=LOG(10) 'for use in log to base 10 calculations (logx=lnx/ln10)
- 110 PI=3.141592654#
- 120 '
- 130 '
- 140 KEY OFF : COLOR 15,1,5 : CLS
- 150 '
- 160 PRINT" Copyright (c) 1985 by Drew Daniels
- 170 PRINT" BOX&PORT.BAS program to calculate dimensions and porting"
- 180 PRINT" for loudspeaker enclosures with ideal shapes."
- 190 PRINT : PRINT
- 200 PRINT " ENCLOSURE DIMENSION DESIGN SUBROUTINE"
- 210 PRINT : PRINT
- 220 PRINT " [A] Find Dimensions from Volume [D] Volume of Suggested Bracing"
- 230 PRINT " [B] Find Volume from Largest Dimension [E] Design Vent for Enclosure"
- 240 PRINT " [C] Find Volume from Existing Dimensions Enter your choice . . ."
- 250 A$=INPUT$(1)
- 260 IF A$="A" OR A$="a" THEN 310 ELSE 270
- 270 IF A$="B" OR A$="b" THEN 430 ELSE 280
- 280 IF A$="C" OR A$="c" THEN 530 ELSE 290
- 290 IF A$="D" OR A$="d" THEN 570 ELSE 300
- 300 IF A$="E" OR A$="e" THEN 970 ELSE 250
- 310 PRINT
- 320 INPUT "Enter desired box volume in cubic feet ",CUFT
- 330 IF CUFT >.01 THEN GOTO 340
- 340 CUIN=CUFT*1728 : VTEMP=CUIN^.333333333# 'cube root
- 350 AAA=VTEMP*1.20125 : BBB=AAA*.816496581# : CCC=AAA*.707106781# 'constant
- 360 PRINT
- 370 PRINT" DIMENSION SIDE A SIDE B SIDE C"
- 380 PRINT" -------- -------- --------"
- 390 PRINT USING" interior ###.# inches ###.# inches ###.# inches";AAA, BBB, CCC
- 400 PRINT USING" exterior ###.# inches ###.# inches ###.# inches";AAA+1.5, BBB+1.5, CCC+1.5
- 410 PRINT
- 420 GOTO 220
- 430 PRINT : INPUT"What is the largest INTERNAL dimension of the box ";AAA
- 440 PRINT
- 450 BBB = AAA * .816496581# : CCC = AAA * .707106781#
- 460 VOLUME = AAA * BBB * CCC / 1728
- 470 PRINT" DIMENSION SIDE A SIDE B SIDE C VOLUME"
- 480 PRINT" ------ ------ ------ ------"
- 490 PRINT USING" interior ##.# ##.# ##.# ###.##";AAA ,BBB, CCC, VOLUME
- 500 PRINT USING" exterior ##.# ##.# ##.# ###.##";AAA+1.5, BBB+1.5, CCC+1.5
- 510 PRINT
- 520 GOTO 220
- 530 PRINT : INPUT"Enter the interior dimensions of your box, in inches, separated by commas. ",A,B,C
- 540 D=A*B*C/1728
- 550 PRINT USING "The volume of your box is ##.## cubic feet.";D
- 560 GOTO 410
- 570 PRINT
- 580 INPUT " Enter desired box volume in cubic feet ",CUFT
- 590 IF CUFT=0 THEN CLS : GOTO 580
- 600 CUIN=CUFT*1728 : VTEMP=CUIN^.333333333# 'cube root
- 610 AAA=VTEMP*1.20125 : BBB=AAA*.816496581# : CCC=AAA*.707106781# 'constant
- 620 IF CUFT < 1 THEN 630 ELSE 640
- 630 CLS : GOTO 740
- 640 IF CUFT < 4 THEN 650 ELSE 660
- 650 CLS : GOTO 690
- 660 IF CUFT > 4 THEN 670
- 670 CLS : GOTO 730
- 675 '
- 680 '
- 690 BRACEVOLUME=(3*((AAA*2)+(CCC*4)))/1728 : PRINT : GOTO 700
- 700 PRINT "Smaller volumes are calculated using 1x3 pine cleats for bracing."
- 710 GOTO 820
- 720 BRACEVOLUME=(1.5*3.5*((AAA*2)+(CCC*4)))/1728 : GOTO 800
- 730 BRACEVOLUME=(1.5*3.5*((AAA*2)+(CCC*5)))/1728 : GOTO 800
- 740 PRINT
- 750 PRINT "Bracing is generally not needed in small enclosures made of dense"
- 760 PRINT "materials. If bracing is desired, use 1-in by 3-in pine cleats and"
- 770 PRINT "calculate their volume by the formula 1 x 3 x length/1728 to find"
- 780 PRINT "the total displacement volume in cubic feet.
- 790 PRINT : GOTO 220
- 800 PRINT
- 810 PRINT "Larger volumes are calculated using two by four cleats for bracing."
- 820 PRINT
- 830 PRINT USING " THE BRACING TAKES UP .## CUBIC FOOT OF BOX VOLUME.";BRACEVOLUME
- 840 PRINT
- 850 PRINT "Proper bracing consists of two pieces running from top to bottom on"
- 860 PRINT "the back of the box, and two pieces running from front to back on"
- 870 PRINT "each of the two sides of the box. In larger boxes, another piece"
- 880 PRINT "should be run from front to back somewhere near the center of the"
- 890 PRINT "baffle and back panel of the box. The bracing should be glued and"
- 900 PRINT "screwed down, on edge, to the panels it is stiffening. In addition"
- 910 PRINT "the baffle cutout disc that is normally discarded, can be glued and"
- 920 PRINT "screwed down to one of the box panels for stiffening."
- 930 PRINT "Front-mounted JBL drivers displace the following volumes:"
- 940 PRINT "8in=.05 cu.ft., 10in=.1 cu.ft., 12in=.15 cu.ft., 15in=.2 cu.ft.,18in=.3 cu.ft."
- 950 PRINT
- 960 GOTO 220
- 970 CLS
- 974 '
- 975 '
- 980 '======= VENT DESIGN =======
- 990 '
- 1000 GOSUB 1160 'design data input
- 1010 GOSUB 2050 'minimum vent size calculations
- 1020 PRINT
- 1030 PRINT USING " Minimum Vent AREA is ###.# square inches"; SV.MIN
- 1040 SVMINDIAM = SQR(SV.MIN/PI)*2
- 1050 PRINT USING" The DIAMETER of a tubular duct would be ##.# inches";SVMINDIAM
- 1060 PRINT USING " Duct LENGTH is ###.# inches, tuning a ##.# cubic foot box to ###.# Hz";LV,VBV,FBV
- 1070 VVMIN=SV.MIN*LV : VVVMIN=VVMIN/1728
- 1080 PRINT USING " The duct VOLUME is #,### cubic inches or #.## cubic feet.";VVMIN,VVVMIN
- 1090 PRINT
- 1100 PRINT " >>> DUCT VOLUME MUST BE ADDED TO THE DESIRED ENCLOSURE VOLUME. <<<"
- 1110 PRINT
- 1120 PRINT
- 1130 GOTO 1320 'vent menu
- 1140 '
- 1150 '
- 1160 '======= INPUT VENT DESIGN DATA =======
- 1170 '
- 1180 CLS
- 1190 PRINT " VENTED LOUDSPEAKER ENCLOSURE DUCT DESIGN SUBROUTINE"
- 1200 PRINT
- 1210 PRINT " [ Type CTRL-C and then F2 to go back to main menu ]"
- 1220 PRINT : PRINT : PRINT
- 1230 INPUT " Box internal volume (Vb) in cubic feet";VBV
- 1240 IF VBV < .1 THEN 1230
- 1250 INPUT " Box helmholtz tuning frequency (Fb) in Hz";FBV
- 1260 IF FBV < .1 THEN 1250
- 1270 INPUT " Driver displacement volume (Vd) in cubic inches";VDV
- 1280 IF VDV < .1 THEN 1270
- 1290 RETURN
- 1300 '
- 1310 '
- 1320 '======= VENT DESIGN MENU =======
- 1330 '
- 1340 LOCATE 20,45 : PRINT " FUNCTION MENU"
- 1350 LOCATE 21,45 : PRINT " [A] Select Volume and Tuning"
- 1360 LOCATE 22,45 : PRINT " [B] Change Vent Area or Diameter"
- 1370 LOCATE 23,45 : PRINT " [C] Change Duct Length"
- 1380 LOCATE 24,45 : PRINT " [D] Design Box"
- 1390 LOCATE 24,45 : PRINT " Enter your choice . . ."
- 1400 PRINT
- 1410 CHOICE$=INPUT$(1)
- 1420 IF CHOICE$="A" OR CHOICE$="a" THEN 970 ELSE 1430
- 1430 IF CHOICE$="B" OR CHOICE$="b" THEN 1480 ELSE 1440
- 1440 IF CHOICE$="C" OR CHOICE$="c" THEN 1830 ELSE 1450
- 1450 IF CHOICE$="D" OR CHOICE$="d" THEN 50 ELSE 1410
- 1460 '
- 1470 '
- 1480 '======= CHANGE VENT AREA, FIND DUCT LENGTH =======
- 1490 '
- 1500 IF SV.MIN=0 THEN GOSUB 1160 ELSE 1520 'input data if missing
- 1510 GOSUB 2050 'find minimum vent area
- 1520 CLS : PRINT : PRINT
- 1530 GOTO 1560
- 1540 PRINT " Type 'A' to enter area, type 'D' to enter diameter."
- 1550 PRINT
- 1560 PRINT " Are you entering vent area [A] or diameter [D]"
- 1570 CALC$=INPUT$(1) : PRINT TAB(40)CALC$
- 1580 IF CALC$="D" OR CALC$="d" THEN 1600 ELSE 1590
- 1590 IF CALC$="A" OR CALC$="a" THEN 1640 ELSE 1540
- 1600 INPUT " Vent diameter Dv in inches";SVDIAM : PRINT
- 1610 IF SVDIAM < 1 THEN 1600
- 1620 SV=PI*(SVDIAM/2)^2
- 1630 PRINT USING" Vent AREA Sv is ###.# square inches";SV : GOTO 1680
- 1640 INPUT " Vent area Sv in square inches";SV
- 1650 IF SV < 1 THEN 1640
- 1660 DV=SQR(SV/PI)*2
- 1670 PRINT USING" The equivalent DIAMETER of this area is ###.# inches";DV
- 1680 IF SV<SV.MIN THEN GOSUB 2180 'for warning message
- 1690 LV=SV/SV.LV-.825*SQR(SV)
- 1700 CUIN=SV*LV
- 1710 CUFT=CUIN/1728
- 1720 PRINT
- 1730 PRINT USING" Duct LENGTH is ###.# inches";LV
- 1740 PRINT USING" Duct VOLUME is #,### cubic inches or #.## cubic feet.";CUIN,CUFT
- 1750 PRINT " THIS VOLUME MUST BE ADDED TO THE DESIRED ENCLOSURE VOLUME."
- 1760 PRINT " Helmholtz Frequency (Fb) =";FBV;"Hz"
- 1770 PRINT " Box Volume (Fb) =";VBV;"cubic feet
- 1780 PRINT
- 1790 IF LV < .5 THEN 2300
- 1800 GOTO 1320
- 1810 '
- 1820 '
- 1830 '======= CHANGE DUCT LENGTH, FIND VENT AREA =======
- 1840 '
- 1850 IF SV.MIN=O THEN GOSUB 1160 ELSE 1870 'input data if missing
- 1860 GOSUB 2050 'find minimum vent area
- 1870 CLS : PRINT : PRINT : PRINT : PRINT
- 1880 GOTO 1900
- 1890 PRINT" WARNING: DUCT LENGTH IS LESS THAN 3/4-INCH (BAFFLE THICKNESS)."
- 1900 INPUT " Duct LENGTH in inches";LV
- 1910 IF LV < .75 THEN 1890
- 1920 SV=((SV.LV*.825+SQR((SV.LV*.825)^2+4*SV.LV*LV))/2)^2
- 1930 PRINT USING" Vent AREA is ###.# square inches";SV
- 1940 VENTDIAM = SQR(SV/PI)*2
- 1950 PRINT USING" Vent DIAMETER is ##.# inches";VENTDIAM
- 1960 CUIN=SV*LV
- 1970 CUFT=CUIN/1728
- 1980 PRINT USING" Duct VOLUME is #,### cubic inches or #.## cubic feet.";CUIN,CUFT
- 1990 IF SV<SV.MIN THEN GOSUB 2180 'for warning message
- 2000 PRINT " Helmholtz Frequency (Fb) =";FBV;"Hz"
- 2010 PRINT " Box Volume (Vb) =";VBV;"cubic feet"
- 2020 GOTO 1320
- 2030 '
- 2040 '
- 2050 '======= MINIMUM VENT SIZE CALCULATIONS =======
- 2060 '
- 2070 L=2350/(FBV^2*VBV)
- 2080 SV.MIN=8.25*VDV/(SQR(FBV))
- 2090 SV.LV=1728*VBV*(6.2832*FBV/13504)^2 'vent area-to-effective-length ratio
- 2100 LV=SV.MIN/SV.LV-.825*SQR(SV.MIN)
- 2110 IF LV<.75 THEN LV=.75
- 2120 SV.MIN=((SV.LV*.825+SQR((SV.LV*.825)^2+4*SV.LV*LV))/2)^2
- 2130 SVMINDIAM=SQR(SV.MIN/PI)*2
- 2140 LV=INT(LV*10^2+.5)/10^2
- 2150 RETURN
- 2160 '
- 2170 '
- 2180 '======= WARNING MESSAGE =======
- 2190 '
- 2200 COLOR 7
- 2210 PRINT USING " WARNING: this vent area is less than the desired minimum of ###.#";SV.MIN
- 2220 PRINT " square inches as recommended in Small to keep air particle velocity
- 2230 PRINT " in the vent below 2% of the speed of sound, for near-lossless
- 2240 PRINT " system tuning. Acceptably good results can be obtained by using
- 2250 PRINT " one port per driver whose diameter is AT LEAST 1/3 that of the
- 2260 PRINT " driver, or whose area is equal to a circle with that diameter.
- 2270 COLOR 15
- 2280 RETURN
- 2290 '
- 2300 PRINT " DESIGN ERROR - PROGRAM ABORTED"
- 2310 PRINT " Press F2 key to restart the program."
- 2320 STOP
- 2330 '
- 2340 '
- 2350 END